<?php
require_once __DIR__ . '/lib/BYGetTokenClient.php';

require_once __DIR__ . '/lib/EncryptUtil.php';



//获取token
$client_id = "Gk0yeD1Pdlw8HCbq";//请申请的应用appKey
$client_secret = "5ZoHVBmaHmaHrOh0at6P38Go7Tplfh";//请填入申请的appSecret

$token = new BYGetTokenClient( $client_id , $client_secret );
$grant_type = 'platform';
$company_id = 44748;

$res=setToke($token->get_token( $grant_type , $company_id )['data']['access_token']);

echo $res;

function setToke($toke){

	$qure="UPDATE toke SET toke='{$toke}' WHERE name_i='by';";

	$host='localhost';
	$user='root';
	$password='root';
	$database='weizandata';
	$link=mysqli_connect($host, $user, $password, $database);
	$link->query("set names utf8");
	$result=mysqli_query($link, $qure);


	return $result;
}

